from django.db import models

class Brands(models.Model):
    name = models.CharField(max_length=30)
    image = models.CharField(max_length=50)
    rating = models.SmallIntegerField()

    class Meta:
        db_table = "brands"

class Clients(models.Model):
    city_id = models.SmallIntegerField()
    name = models.CharField(max_length=50)
    surname = models.CharField(max_length=50)
    patronymic = models.CharField(max_length=50)
    email = models.CharField(max_length=50)
    password = models.CharField(max_length=40)
    company = models.CharField(max_length=100)
    date_registration = models.DateTimeField()
    last_activity = models.DateTimeField()

    class Meta:
        db_table = "clients"


class Regions(models.Model):
    name = models.CharField(max_length=45)

    def __unicode__(self):
        return self.name

    class Meta:
        db_table = "regions"

class City(models.Model):
    region = models.ForeignKey(Regions, related_name="city")
    name = models.CharField(max_length=50)

    def __unicode__(self):
        return self.name

    class Meta:
        db_table = "city"
